<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script type="text/javascript">
(function(){
	$("#clType").attr("value","${requestScope.priceSeachBean.type}");
	$("#pstatus").attr("value","${requestScope.priceSeachBean.status}");
	
	
	if($("#channelNum").val() != ""){
		var stp = document.getElementById("stPartition");
		$.post("../partitionJson!findSPartitions.action",{"channelNumber":$("#channelNum").val()},function(data){
			$(data.spartitions).each(function(){
				stp.options.add(new Option(this.partition_name,this.partition_number));
			});
			$("#stPartition").attr("value","${requestScope.priceSeachBean.startPartitionNumber}");
		});
	}
})();
</script>
<script type="text/javascript" src="<%=basePath%>backgroundManager/js/ltlPriceManage.js"></script>
<form id="pagerForm" method="post" action="<%=basePath%>price_findPrices.action"> <!-- 此action指定的是排序、分页所提交的action -->
	<input type="hidden" name="status" value="${param.status}">
	<input type="hidden" name="keywords" value="${param.keywords}" />
	<input type="hidden" name="pageNum" value="${requestScope.pageNum}" />
	<input type="hidden" name="numPerPage" value="${model.numPerPage}" />
	<input type="hidden" name="orderField" value="${param.orderField}" />
	<input type="hidden" name="orderDirection" value="${param.orderDirection}" />
	<!-- 存放查询条件 -->
	<input name="channelNum" type="hidden" value="${requestScope.channelNum}" />
	<input name="priceSeachBean.channelName" type="hidden" value="${requestScope.priceSeachBean.channelName}" />
	<input name="priceSeachBean.startPartitionNumber" type="hidden" value="${requestScope.priceSeachBean.startPartitionNumber}" />
	<input name="priceSeachBean.startDate" type="hidden" value="${requestScope.priceSeachBean.startDate}" />
	<input name="priceSeachBean.endDate" type="hidden" value="${requestScope.priceSeachBean.endDate}" />
	<input name="priceSeachBean.type" type="hidden" value="${requestScope.priceSeachBean.type}" />
	<input name="priceSeachBean.status" type="hidden" value="${requestScope.priceSeachBean.status}" />
</form>

<div class="pageHeader">
	<form name="findChannelForm" onsubmit="return navTabSearch(this);" action="<%=basePath%>price_findPrices.action?numPerPage=10&pageNum=1&orderField=P_PRICE_ID&orderDirection=asc" method="post">
	<div class="searchBar">
				<div class="pageFormContent1">
					<p>
					<label width="50">渠道名称：</label>
					<input id="channelNum_ltl" name="channelNum" type="hidden" value="${requestScope.channelNum}" />
					<input id="channelName_ltl" type="text" name="priceSeachBean.channelName" size="13" value="${requestScope.priceSeachBean.channelName}" readonly />
					<input id="seachChannelBtn_ltl" type="button" value="..." />
					</p>
					<p>
					<label>有效日期起：</label>
					<input type="text" value="<fmt:formatDate value="${requestScope.priceSeachBean.startDate}" type="date" dateStyle="long"/>" name="priceSeachBean.startDate" class="date" format="yyyy年MM月dd日" yearstart="-5" yearend="5" readonly />
					</p>
					<p>
					<label>有效日期止：</label>
					<input type="text" value="<fmt:formatDate value="${requestScope.priceSeachBean.endDate}" type="date" dateStyle="long"/>" name="priceSeachBean.endDate" class="date" format="yyyy年MM月dd日" yearstart="-5" yearend="5" readonly />
					</p>
					<p>
					<label>客户类别：</label>
					<select id="clType" name="priceSeachBean.type" class=" combox">
					<option value="" selected>全部</option>
					<c:forEach items="${sessionScope.clientClasses}" var="clientClass">
						<option value="${clientClass.classNumber}">${clientClass.className}</option>
					</c:forEach>
					</select>
					</p>
					<p>
					<label>是否审批：</label>
					<select id="pstatus" name="priceSeachBean.status" class=" combox">
					<option value="" selected>全部</option>
					<option value="NE">已审批</option>
					<option value="CL">未审批</option>
					</select>
					</p>
				</div>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">&nbsp;&nbsp;&nbsp;查&nbsp;&nbsp;询&nbsp;&nbsp;&nbsp;</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="<%=basePath%>ltlPrice_loadImportLtlPrice.action" target="navTab" title="添加价格" rel="addPrice"><span>添加价格</span></a></li>
			<li><a class="delete" href="<%=basePath%>price_delPrice.action" posttype="string" rel="ids" target="selectedTodo" title="确定要删除吗?"><span>删除价格</span></a></li>
			<li><a class="edit" href="<%=basePath%>price_previewPrices.action?priceID={sid_user}" target="navTab" rel="previewPrice"><span>预览报价</span></a></li>
			<li class="line">line</li>
			<li><a class="icon" href="demo/common/dwz-team.xls" target="dwzExport" targetType="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="194">
		<thead>
			<tr>
				<th width="30"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th width="120" orderField="P_CHANNEL_NAME" class="${requestScope.orderDirection}">渠道名称</th>
				<th width="100" orderField="P_PARTITION_NAME" class="${requestScope.orderDirection}">起始地区</th>
				<th width="80"orderField="CLASS_NUMBER" class="${requestScope.orderDirection}">客户类别</th>
				<th width="80"orderField="P_PRICE_START_DATE" class="${requestScope.orderDirection}">有效时间起</th>
				<th width="80"orderField="P_PRICE_END_DATE" class="${requestScope.orderDirection}">有效时间止</th>
				<th width="80"orderField="PRICE_STAFF_NUMBER" class="${requestScope.orderDirection}">添加人员</th>
				<th width="60"orderField="P_PRICE_STATUS" class="${requestScope.orderDirection}">是否审批</th>
				<th width="80"orderField="PRICE_STAFF_NUMBERS" class="${requestScope.orderDirection}">审批人</th>
				<th width="80"orderField="P_PRICE_APPROVAL_DATE" class="${requestScope.orderDirection}">审批日期</th>
				<th width="190">说明</th>
				<th width="80"orderField="P_PRICE_ADD_DATE" class="${requestScope.orderDirection}">添加日期</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${requestScope.priceList}" var="price">
			<tr target="sid_user" rel="${price.priceID}">
				<td><input name="ids" value="${price.priceID}" type="checkbox"></td>
				<td>${price.channelName}</td>
				<td>${price.startPartitionName}</td>
				<td><c:if test="${price.fuel eq true}">是</c:if><c:if test="${price.fuel eq false}">否</c:if></td>
				<td>${price.clientClassName}</td>
				<td>${price.startDate}</td>
				<td>${price.endDate}</td>
				<td>${price.handelStaff}</td>
				<td><c:if test="${price.status eq 'NE'}">已审批</c:if><c:if test="${price.status eq 'CL'}">未审批</c:if> </td>
				<td>${price.approvalStaff}</td>
				<td>${price.approvalDate}</td>
				<td>${price.note}</td>
				<td>${price.addDate}</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select id="countSelect" class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})"  >
				<option value="10">10</option>
				<%--<option value="50">50</option>	
				<option value="100">100</option>
			--%></select>
			<span>条，共${requestScope.totalRecords}条</span>
		</div>
		
		<div class="pagination" targetType="navTab" totalCount="${requestScope.totalRecords}" numPerPage="${requestScope.pageSize}" pageNumShown="${requestScope.totalPages}" currentPage="${requestScope.pageNum }"></div>

	</div>
</div>
<script type="text/javascript">
	(function () {
		var a = document.getElementById("countSelect");
		switch(${requestScope.numPerPage}){
			case 10:
				a.options.selectedIndex = 0;
				break;
			case 50:
				a.options.selectedIndex = 1;
				break;
			case 100:
				a.options.selectedIndex = 2;
				break;
		}
	})();
</script>